package com.springboot.ssm.controller;


import com.baomidou.mybatisplus.extension.service.IService;
import com.springboot.ssm.entity.Teacher;
import com.springboot.ssm.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.springboot.ssm.common.BaseController;

import java.util.Optional;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sl
 * @since 2021-05-26
 */
@RestController
@RequestMapping("/teacher")
public class TeacherController extends BaseController {

    @Autowired
    private ITeacherService iTeacherService;

    @Override
    public IService getIService() {
        return iTeacherService;
    }

    @RequestMapping("/{id}")
    public Teacher findOne(@PathVariable("id")  Integer id){
        Optional<Teacher> opl=Optional.ofNullable(iTeacherService.getById(id));
        return opl.get();
    }
}
